home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / studio / common / framewnd.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  4KB  |  142 lines

  1. /*
  2.  
  3.   Nullsoft WASABI Source File License
  4.  
  5.   Copyright 1999-2001 Nullsoft, Inc.
  6.  
  7.     This software is provided 'as-is', without any express or implied
  8.     warranty.  In no event will the authors be held liable for any damages
  9.     arising from the use of this software.
  10.  
  11.     Permission is granted to anyone to use this software for any purpose,
  12.     including commercial applications, and to alter it and redistribute it
  13.     freely, subject to the following restrictions:
  14.  
  15.     1. The origin of this software must not be misrepresented; you must not
  16.        claim that you wrote the original software. If you use this software
  17.        in a product, an acknowledgment in the product documentation would be
  18.        appreciated but is not required.
  19.     2. Altered source versions must be plainly marked as such, and must not be
  20.        misrepresented as being the original software.
  21.     3. This notice may not be removed or altered from any source distribution.
  22.  
  23.  
  24.   Brennan Underwood
  25.   brennan@nullsoft.com
  26.  
  27. */
  28.  
  29. //NONPORTABLE
  30. #ifndef _FRAMEWND_H
  31. #define _FRAMEWND_H
  32.  
  33. #include "common.h"
  34. #include "labelwnd.h"
  35. #include "autobitmap.h"
  36.  
  37. #define MAXCHILD 2    // this had better never not be 2
  38.  
  39. typedef enum {
  40.   DIVIDER_HORIZONTAL, DIVIDER_VERTICAL, DIVIDER_UNDEFINED = -1
  41. } FrameWndDividerType;
  42. enum { SDP_FROMLEFT, SDP_FROMRIGHT };
  43. #define SDP_FROMTOP SDP_FROMLEFT
  44. #define SDP_FROMBOTTOM SDP_FROMRIGHT
  45.  
  46. typedef enum {
  47.   FRAMEWND_SQUISH,
  48.   FRAMEWND_COVER
  49. } FrameWndSlideMode;
  50.  
  51. #define SIZERWIDTH 8
  52.  
  53. // this window holds other basewnd derived classes
  54. #define FRAMEWND_PARENT LabelWnd
  55. class COMEXP FrameWnd : public FRAMEWND_PARENT {
  56. public:
  57.   FrameWnd();
  58.   virtual ~FrameWnd();
  59.  
  60.   virtual int onInit();
  61.  
  62.   virtual int getCursorType(int x, int y);
  63.  
  64.   virtual int onPaint(Canvas *canvas);
  65.   virtual int onResize();
  66.  
  67.   virtual int onLeftButtonDown(int x, int y);
  68.   virtual int onMouseMove(int x, int y);    // only called when mouse captured
  69.   virtual int onLeftButtonUp(int x, int y);
  70.   virtual int onLeftButtonDblClk(int x, int y);
  71.  
  72.   virtual int childNotify(RootWnd *which, int msg, int param1, int param2);
  73.  
  74.   virtual int forceFocus();
  75.  
  76.   // unique to this class
  77.   int setChildren(BaseWnd *child1, BaseWnd *child2=NULL);
  78.   BaseWnd *enumChild(int which);
  79.   // horizontal or vertical?
  80.   void setDividerType(FrameWndDividerType type);
  81.   FrameWndDividerType getDividerType();
  82.   // where is the divider?
  83.   int setDividerPos(int from, int pos);
  84.   // this version doesn't check the cfg file for last position
  85.   int setDividerPosNoCfg(int from, int pos);
  86.   void getDividerPos(int *from, int *pos);
  87.  
  88.   int setResizeable(int is);
  89.   void setMinWidth(int min);
  90.  
  91.   void onSetVisible(int show);
  92.  
  93.   // cover or squish
  94.   void setSlideMode(FrameWndSlideMode mode);
  95.   FrameWndSlideMode getSlideMode();
  96.  
  97.   // drag and drops are forwarded into windowshaded windows
  98.   virtual int dragEnter(RootWnd *sourceWnd);
  99.   virtual int dragOver(int x, int y, RootWnd *sourceWnd);
  100.   virtual int dragLeave(RootWnd *sourceWnd);
  101.   virtual int dragDrop(RootWnd *sourceWnd, int x, int y);
  102.  
  103. protected:
  104.   int convertPropToPix(int prop);
  105.   int ConvertPixToProp();
  106.  
  107.   void windowshade(int which, int shaded);
  108.   BaseWnd *getWindowShadedChild();
  109.  
  110. private:
  111.   int nchild;
  112.   BaseWnd *children[MAXCHILD];
  113.   int hidey[MAXCHILD];
  114.   int windowshaded[MAXCHILD];
  115.  
  116.   FrameWndDividerType vert;
  117.  
  118.   int resizeable;
  119.   FrameWndSlideMode slidemode;
  120.  
  121.   int divideside;
  122.   int pullbarpos;    // 0..65536
  123.   int prevpullbarpos;
  124.   int minwidth, maxwidth;
  125.  
  126.   int fake_focus;
  127.  
  128.   int down;
  129.  
  130.   RECT sizerRect;
  131.  
  132.   AutoSkinBitmap h_bitmap, v_bitmap, h_grabber, v_grabber, ws_bitmap;
  133. };
  134.  
  135. #define PULLBAR_FULL 65536L
  136. #define PULLBAR_HALF (PULLBAR_FULL/2)
  137. #define PULLBAR_QUARTER (PULLBAR_FULL/4)
  138. #define PULLBAR_THREEQUARTER (PULLBAR_FULL-PULLBAR_QUARTER)
  139. #define PULLBAR_EIGHTH (PULLBAR_FULL/8)
  140.  
  141. #endif
  142.